<?php include $this->admin_tpl("header"); ?>
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH;?>EasyUI/themes/haidaoblue/easyui.css">
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH;?>EasyUI/themes/icon.css">
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/hd_default_config.js"></script>

<script type="text/javascript" src="<?php echo JS_PATH;?>layer/layer.js"></script>
<style type="text/css">
	.layui-layer-content{ text-align: center; }
	.layui-layer-content img{ max-height: 500px; }
</style>
<div class="content">
	<div class="site"><?php echo C('site_name')?> <a href="#">会员管理</a> > 会员认证列表</div>
	<span class="line_white"></span>
	<div class="goods mt10">
		<div class="guanli">
			<form action="<?php echo U('Member/user_renzheng'); ?>" method='post'>
				<span style="margin-right: 10px;margin-left: 10px;">搜索</span>
				<input id="keyword" class="easyui-textbox" name="keyword" style="width:210px;height: 26px;" prompt="输入会员名或真实姓名可搜索">
				
				<!-- <span style="margin-right: 10px;">认证提交时间 </span>
				<input class="easyui-datebox" name="start" id="start" style="width: 100px;" data-options="sharedCalendar:'#cc'">
				<span style="margin-right: 10px;">至</span>
				<input class="easyui-datebox" name="end" id="end" style="width: 100px;" data-options="sharedCalendar:'#cc'" validType="md['#start']"> -->

				<a id="search" href="#" class="easyui-linkbutton" style="height: 26px;padding-right: 10px;">查询</a>
			</form>
		</div>
		<div class="login mt10" style="border: none;">
			<table id="member_list" style="width:100%"></table>
			<div class="clear"></div>
		</div>
		<?php include $this->admin_tpl("copyright"); ?>
		<div class="clear"></div>
    </div>



    <div id="moneypanel" class="easyui-window"  style="width:320px;" closed="true" modal="true" minimizable="false" maximizable="false" collapsible="false" data-options="title:'审核'">
		<form id="SetMoneyForm" class="setmoneyform" method="post" action="<?php echo U('Member/setrenzheng'); ?>">
		<div class="login " style="border: none;">
			
			<div class="table">
				<table>
				<tr style="border-top: none;">
					<td>处理方式</td>
					<td align="left">
						<input type="radio" value="3" name="if_identification" checked>通过 
						<input type="radio" value="4" name="if_identification">驳回</td>
					<td align="left"></td>
				</tr>
				<tr style="border-bottom:1px solid #CCCCCC;border-top: none;">
					<td>备注</td>
					<td align="left" colspan="2">
						<input type="text" value="" style="margin:0;" class="input_ss" name="identification_remarks" >
					</td>
				</tr>
				</table>
			</div>
		</div>
		<div data-options="region:'south',border:false" style="text-align:right;padding:5px 20px;">
			<a class="easyui-linkbutton"  href="javascript:void(0)" onclick="$('#SetMoneyForm').submit()" style="padding: 0 10px;">确定</a>
			<a class="easyui-linkbutton"  href="javascript:void(0)" onclick="$('#moneypanel').window('close');" style="padding: 0 10px;">取消</a>
		</div>
			<input type="hidden" name="user_id" value="" />
		</form>
	</div>

<script type="text/javascript">
	var dom = $('#member_list');
	var pageSize = <?php echo PAGE_SIZE?>;
	var dataurl = '<?php echo U('user_renzheng')?>';

	var addurl = '<?php echo U('add')?>';
	var delurl = '<?php echo U('delete')?>';
	var editurl = '<?php echo U('edit')?>';

	var addressurl = '<?php echo U('MemberAddress/lists')?>';
	var rebateurl = '<?php echo U('Memberrebate/lists')?>';
	var sellrebateurl = '<?php echo U('Memberrebate/selllists')?>';
	var orderurl = '<?php echo U('Goods/AdminOrder/lists')?>';
	
	var repasswordurl = '<?php echo U('repassword')?>';
	var repinpassurl = '<?php echo U('repinpass')?>';
	var setpotionsurl = '<?php echo U('setpoints')?>';

	var statusurl = '<?php echo U('xiugai',array('opt'=>'ajax_status'))?>';

	$(function(){
		dom.datagrid({
			url:dataurl,
			striped:true,
			width:'100%',
			title:"统计概览",  
			fitColumns:true,
			checkOnSelect:true,
			pagination:true,
			pageSize:pageSize,
			pageList: [pageSize,pageSize*2,pageSize*4],
			columns:[[
				{field:'id',title:'ID',fixed:true,align:'center',width:'5%'},
				{field:'username',title:'会员名',fixed:true,align:'center',width:'8%'},
				{field:'real_name',title:'真实姓名',align:'center',width:'6%',align:'center'},
				{field:'identidy_number',title:'身份证号码',align:'center',width:'15%',align:'center'},
				{field:'identity_front',title:'身份证正面',width:'7%',halign:'center',align:'center',
					formatter: function (value, row, index) {
						if(value=="") return "<span class=red>未上传</span>";
						return "<a href='javascript:showImg(\""+value+"\") '>查看</a>";                     
					}
				},
				{field:'identity_side',title:'身份证反面',width:'7%',halign:'center',align:'center',
					formatter: function (value, row, index) { 
						if(value=="") return "<span class=red>未上传</span>";
						return "<a href='javascript:showImg(\""+value+"\") '>查看</a>";                     
					}
				},

				{field:'balance',title:'余额',align:'center',width:'10%',align:'center'},
				{field:'freeze_balance',title:'冻结金额',align:'center',width:'10%',align:'center'},
				{field:'upvaluation',title:'升值链',align:'center',width:'10%',align:'center'},
				{field:'status',title:'状态',align:'center',width:'5%',align:'center'
					,formatter:function(value,row,index){
						if(value==="0") return "已冻结";
						if(value==1) return "正常";
						// if(value==2) return "驳回";
						// return "未审核";
					}
				},



				{field:'identification_time',title:'提交时间',width:'10%',align:'center',sortable:false,},
				{field:'register_time',title:'注册时间',width:'10%',align:'center',sortable:false},
				{field:'userID',title:'操作',width:'5%',align:'center',halign:'center',
					formatter:function(value,row,index){
						var sp_txt="&nbsp;&nbsp;&nbsp;&nbsp;";
						return '<a  href="javascript:void (0)" onclick="alert_window('+row.id+','+index+')">会员认证审核</a>';
						// return '<a  href="javascript:void (0)" onclick="user_money('+row.id+','+index+')">审核</a>';
							// return '<a  href="'+editurl+'&id='+row.id+'">审核</a>';
						}
				},
			]],
			onLoadSuccess:function(data){

				$(".panel-title").eq(0).html(data.title);
				// var group = data.user_type;
				// group.unshift({"id":"","name":"请选择"})
				// $('#group_combbox').combobox({
				// 	data:group,
				// 	valueField:'id',
				// 	textField:'name'
				// });

			}
		});
		//回车查询
		$('#keyword').textbox('textbox').bind('keydown',function (e) {
			if (e.keyCode == 13) {
				$('#search').trigger('click');
			}
		});
		//增加查询参数，重新加载表格
		$('#search').bind('click',function (){
			var queryParams = dom.datagrid('options').queryParams;
		//查询参数直接添加在queryParams中
			queryParams.keyword = $("#keyword").val();
			// queryParams.user_type = $('#group_combbox').combobox('getValue');
			dom.datagrid('options').queryParams = queryParams;
			dom.datagrid('reload');
		})
		//添加会员
		$('#addrow').bind('click',function(){
			window.location.href=addurl;
		})
		//删除操作
		$('#delrows').bind('click', function(){
			$.messager.alert('警告','请不要进行删除操作！');
			return false;

			var ids = [];
			var rows = dom.datagrid('getChecked');
			for(var i=0; i<rows.length; i++){
				ids.push(rows[i].id);
			}
			if (ids.length > 0){
				$.messager.confirm('确认','您确认想要删除记录吗？',function(r){
					if (r){
						$.getJSON(delurl,
						{"id[]":ids},
						function(data){
							if(1 == data.status){// 删除成功，则需要在树中删除节点
								// 检修任务grid 执行load
								dom.datagrid("reload");  //重新加载
							}else{
								$.messager.alert('警告',data.info);
							}
						})
					}else{
						dom.datagrid('clearSelections').datagrid('clearChecked');
					}
				});
			}else{
				$.messager.alert('警告','请选择要删除的记录');
				return false;
			}
		});
	});
	//积分弹窗
	function pay_points(value,index){
		$('input[name="user_id"]').val(value);
		$('#poinospanel').window('open');
	}
	//经验
	function exp(value,index){
		$('input[name="user_id"]').val(value);
		$('#exppanel').window('open');
	}
	// 余额
	function alert_window(value,index) {
		$('input[name="user_id"]').val(value);
		$('#moneypanel').window('open');
	}


	function showImg(img){

		layer.open({
		  type: 1,
		  title: "身份证",
		  closeBtn: 1,
		  area: ['1000px','600px'],
		//  skin: 'layui-layer-nobg', //没有背景色
		  shadeClose: 0,
		  content: '<img  src="'+img+'" />'
		});
	}
</script>